package com.samuel.learing.controller.javaBase;


import com.samuel.learing.Person;
import com.samuel.learing.Student;

/**
 * @company: mamahao.com
 * @author: taozhaoyang
 * @time: 2017-12-21 17:18
 * @version: 1.0
 * @desc:
 **/
public class InstanceOfController {


    /**
     * instanceof通过返回一个布尔值来指出，这个对象是否是这个特定类或者是它的子类的一个实例
     * @param args
     */
    public static void main(String[] args) {

        Person p = new Person();

        Student s = new Student();

        System.out.println(p instanceof  Person);
        System.out.println(s instanceof  Person);
        System.out.println(p instanceof  Student);
        /* 打印如下：
            true
            true
            false*/

    }
}